import request from '@/utils/request'

export function listCoupon(query) {
  return request({
    url: '/coupon/list',
    method: 'post',
    // data表示请求头传值,params表示url传值
    data: query
  })
}

export function searchCoupon(data) {
  return request({
    url: '/coupon/search',
    method: 'post',
    data
  })
}

export function createCoupon(data) {
  return request({
    url: '/coupon/create',
    method: 'post',
    data
  })
}

export function readCoupon(id) {
  return request({
    url: '/coupon/' + id,
    method: 'get'
  })
}

export function updateCoupon(data) {
  return request({
    url: '/coupon/',
    method: 'put',
    data
  })
}

export function deleteCoupon(data) {
  return request({
    url: '/coupon/' + data.id,
    method: 'delete'
  })
}

export function listCouponUser(query) {
  return request({
    url: '/coupon/listuser',
    method: 'post',
    data: query
  })
}
